//
// Created by Ivor_ on 2024/2/5.
//

#ifndef PHYSICAL_COMPUTING_PACKAGE_DEQUEUE_H
#define PHYSICAL_COMPUTING_PACKAGE_DEQUEUE_H

#include <malloc.h>
#include <string.h>
#include <stdio.h>

typedef struct DeQueueNode {
    void* data;
    struct DeQueueNode* last, * next;
} DQ_NODE;

typedef struct {
    int len;
    DQ_NODE* top, * bottom;
} DEQUEUE;

//DQ_NODE* createNodeDQ(const void* _data, size_t dataSize, DQ_NODE* _last, DQ_NODE* _next); Forbid to use for user!
DEQUEUE* createDequeueDQ();
//void freeNodeDQ(DQ_NODE* nodeObj); Forbid to use for user!
void freeDequeueDQ(DEQUEUE* dqObj);

void pushTopDQ(const void* _data, size_t dataSize, DEQUEUE* dqObj);
void pushBottomDQ(const void* _data, size_t dataSize, DEQUEUE* dqObj);
void* popTopDQ(DEQUEUE* dqObj, size_t dataSize);
void* popBottomDQ(DEQUEUE* dqObj, size_t dataSize);
void* peekTopDQ(const DEQUEUE* dqObj, size_t dataSize);
void* peekBottomDQ(const DEQUEUE* dqObj, size_t dataSize);

#endif //PHYSICAL_COMPUTING_PACKAGE_DEQUEUE_H
